package org.example.mapper;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.pojo.AddUser;
import org.example.pojo.User;

import java.util.List;
import java.util.Map;


public interface UserMapper {

    @Delete("delete from manager where m_id = #{mId}")
    int deleteUser(int mId);


    @Update("update manager set m_status= #{mStatus} where m_Id =#{mId}")
    int updateStaus(User user);
    @Update("update manager set m_login= #{mLogin} where m_Id =#{mId}")
    int updateLogin(User user);

    @Insert("INSERT INTO manager VALUES(null,#{mNo},#{mName},#{mSex},#{mPhone},#{rName},#{mEmail},#{mPassword},0,0,1)")
    int addUser(AddUser user);

    @Select("select * from manager where m_id = #{mId}")
    User selectUserById(int mId);

    List<User> selectUsers();

//    @Select("select * from manager where m_no=#{mNo} and m_password=#{mPassword}")
    User selectUserByNameAndPwd(User user);

    @Select("select * from manager where m_No = #{No}")
    User selectUserByNo(String No);

    @Update("update manager set m_password = #{mPassword},m_sex=#{mSex},m_phone = #{mPhone},m_email = #{mEmail} where m_no =#{mNo}")
    int updateUserPwd(User user);

    @Update("update users set userAccount = userAccount - #{money} where userId = #{userId}")
    int updateUserSubMoney(Map map);

    List<User> selectVariablesByAll(String var);



}
